<template>
	<navbar titleText="这是标题"></navbar>
	<viewContent :isTabbar='true'>
		{{info.userInfo}}
		<view style="height: 1000px;background-color: aquamarine;">11111</view>
	</viewContent>
</template>

<script setup>
	// 引入
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		login
	} from '@/api/user.js';
	import common from "@/utils/common.js"
	import {
		userInfo
	} from '../../store/modules/user.js';
	import {
		onMounted,
		ref
	} from 'vue'
	// 定义导航栏高度的响应式变量
	const navBarHeight = ref(0);

	// 页面挂载时获取系统信息并计算导航栏高度
	onMounted(() => {
		const systemInfo = uni.getSystemInfoSync();
		console.log(systemInfo, 'systemInfosystemInfo');
		const statusBarHeight = systemInfo.statusBarHeight; // 获取状态栏高度
		// 根据平台计算导航栏高度
		navBarHeight.value = systemInfo.platform === 'android' ?
			statusBarHeight + 48 // Android 导航栏高度
			:
			statusBarHeight + 44; // iOS 导航栏高度
	});

	const info = userInfo();
	// const user= userInfo();
	// 随便测试
	info.setUserInfo(123123123213)
	const mm = () => {
		common.showToast('-----')
		submit()
		console.log(common, 'getCurrentInstance');
	}
	const submit = async () => {
		console.log('-----------1--------');
		// 处理一些表单数据验证
		// 验证通过，发起请求
		const mm = await login({
			uesr: "admin",
			password: "123"
		});
		console.log(mm, 'mmmmmm');
		// 处理登录逻辑
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		display: flex;
margin-top: 30px;
		.content-box {
			width: 100%;
			overflow-y: auto;
		}
	}
</style>